#include<iostream>
#include<mysql/mysql.h>

int main()
{
  //初始化数据库
  MYSQL *mysql = mysql_init(NULL);
  mysql_real_connect(mysql,"localhost","cqy","Cqy125@..","test1",3306,NULL,0);
  if(mysql!=NULL)
  {
    std::cout<<"connect succcess"<<std::endl;
  }
  //设置字符集
  mysql_set_character_set(mysql,"utf8");
  int n = mysql_query(mysql,"insert into emp values (5,'lisi')");


  mysql_close(mysql);
  return 0;
}
